
<!--如果curId=0，第一个div显示，其它3个隐藏   如果curId=1 第2个div显示，其它3个隐藏-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Vue淘宝Tab栏切换</title>
    <!--<script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>-->
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <style>
        #tab{width: 600px;margin: 0 auto;}
        .tab-tit{font-size: 0; width: 600px;}
        .tab-tit a{
            display: inline-block;
            height: 40px;
            line-height: 40px;
            font-size: 16px; width: 25%;
            text-align: center;
            background: #E1E1E1;
            color: #333;
            text-decoration: none;
        }
        .tab-tit .cur{background: #09f; color: #fff;}
        .tab-con div{border: 1px solid #e7e7e7; height: 400px; padding-top: 20px;}

    </style>
</head>
<body>
<div id="tab">
    <div class="tab-tit">
        <a href="javascript:;" @click="curId=0" :class="{'cur': curId===0}">女装</a>
        <a href="javascript:;" @click="curId=1" :class="{'cur': curId===1}">鞋子</a>
        <a href="javascript:;" @click="curId=2" :class="{'cur': curId===2}">包包</a>
        <a href="javascript:;" @click="curId=3" :class="{'cur': curId===3}">男装</a>
    </div>
    <div class="tab-con">
        <div v-show="curId===0">
            <img src="img/01.jpg" alt="01.jpg" width="100%">
        </div>
        <div v-show="curId===1">
            <img src="img/02.jpg" alt="02.jpg" width="100%">
        </div>
        <div v-show="curId===2">
            <img src="img/003.jpg" alt="003.jpg" width="100%">
        </div>
        <div v-show="curId===3">
            <img src="img/004.jpg" alt="004.jpg" width="100%">
        </div>
    </div>
</div>

<script>
    new Vue({
        el: '#tab',
        data: {
            curId: 0
        }
    })
</script>
</body>
</html>

